home *** CD-ROM | disk | FTP | other *** search
/ ftp.cs.arizona.edu / ftp.cs.arizona.edu.tar / ftp.cs.arizona.edu / tsql / doc / tsql.mail / 000156_@ICINECA.CINECA…s64.cineca.it _Wed Jun 9 11:00:17 1993.msg < prev    next >
Internet Message Format  |  1996-01-31  |  38KB

  1. Received: from icineca.cineca.it by optima.CS.Arizona.EDU (5.65c/15) via SMTP
  2.     id AA03501; Wed, 9 Jun 1993 01:58:14 MST
  3. Received: from deis64.cineca.it by ICINECA.CINECA.IT (IBM VM SMTP V2R2)
  4.    with TCP; Wed, 09 Jun 93 10:58:31 SET
  5. Received: from [137.204.57.79] (deis79) by deis64.cineca.it (4.1/SMI-4.1)
  6.     id AA15151; Wed, 9 Jun 93 11:00:16 +0200
  7. Date: Wed, 9 Jun 93 11:00:17 +0100
  8. From: (Fabio Grandi) <fabio@deis64.cineca.it>
  9. Message-Id: <39632.fabio@deis64.cineca.it>
  10. To: csj@iesd.auc.dk
  11. Cc: tsql@cs.arizona.edu
  12. Subject: Benchmark Queries (Classes O1.S5, O1.S6, O2.S7, O2.S8, O3.S9, O3.S10)
  13.  
  14. Dear Christian:
  15.  
  16. please find included our benchmark queries.
  17.  
  18. Each class follows the header:
  19. " %%% Begin of Class: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ".
  20.  
  21. We also wrote explanations for each query,
  22. in order to make clear our categorization choices.
  23. We tried to explicit all the selection conditions
  24. which are often implicit in the English formulation
  25. (or depend on the level of detail adopted in categorization).
  26. Feel free to throw explanations out,
  27. if you consider any of them unnecessary.
  28.  
  29. We didn't repeat categories for a single query,
  30. but we explained how many and which predicates fit in each one.
  31.  
  32. Please, if possible, use for the authors' address list
  33. of the benchmark paper the following affiliation of ours:
  34. Dip. di Elettronica Informatica e Sistemistica,
  35. Universit\`a di Bologna, Italy
  36.  
  37. Sincerely,
  38.     Fabio, Rita and Paolo.
  39.  
  40. LaTeX source follows:
  41. =====================================================================
  42.  
  43. \documentstyle[11pt]{article}
  44.  
  45. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  46. % VARIOUS MACROS
  47. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  48.  
  49. \addtolength{\textwidth}{1.485in}
  50. \setlength{\oddsidemargin}{.1in}
  51. \setlength{\evensidemargin}{.1in}
  52. \addtolength{\topmargin}{-.85in} 
  53. \addtolength{\textheight}{1.8in} 
  54.  
  55. \newcommand{\autsp}{$\;\;\;$}
  56. \long\def\query#1#2#3{\begin{verse} {\bf Query \no} {#1} \end{verse} \begin{verse} {\bf Answer:} {#2} \end{verse} \begin{verse} {\bf Category:} {#3} \end{verse}}
  57. \newcounter{qnumber}
  58. \newcounter{rnumber}[subsection]
  59. \newcounter{gnumber}[subsubsection]
  60. \newcommand{\no}{\setcounter{qnumber}{\value{subsection}} \setcounter{rnumber}{\value{subsubsection}}\protect\refstepcounter{gnumber} Q \protect\theqnumber.\protect\thernumber.\protect\thegnumber:}
  61.  
  62. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  63. % PAPER START
  64. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  65.  
  66. \begin{document}
  67.  
  68. \title{\Large{\bf The TSQL Benchmark} \\
  69.        Query Classes: O1.S5, O1.S6, O2.S7, O2.S8, O3.S9, O3.S10}
  70. \author{Fabio Grandi \autsp Maria Rita Scalas \autsp Paolo Tiberio}
  71. \date{} 
  72. \maketitle
  73.  
  74. \section{The Benchmark Queries}
  75.  
  76. \subsection{Explicit-attribute Output}
  77.  
  78. This section involves queries which return only explicit-attribute
  79. values---no valid-time values are present in the result.
  80.  
  81.  
  82.  
  83. %%% Begin of Class: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  84.  
  85. \subsubsection{Class O1.S5 (Other, Event, Computed)}
  86.  
  87. %%% 01.S5 %%% Q#1 %%%
  88. \query{Find Ed's skills when he joined the Book department}
  89.   {``typing,'' ``filing'' and ``driving.''}
  90.   {(Projected, None) /
  91.    (Containment, Event, Computed) /
  92.    (=, Constant)}
  93.  
  94.   \noindent {\it The employee with name Ed joined the Book department
  95.     on 4/1/87, when he was qualified for typing, filing and driving.
  96.  
  97.     The category
  98.     ``(Containment, Event, Computed)'' indicates that a containment 
  99.     based predicate is used to select skill data containing
  100.     an event-valued argument (i.e. 4/1/87) which is derived from the 
  101.     valid-times of stored facts (begin of the valid-times Ed was
  102.     at the Book department).  Finally, ``(=, Constant)'' indicates
  103.     that there are only non-temporal selection predicates
  104.     that test for equality of an attribute value with a constant
  105.     (i.e., the name of the person is Ed both in employee and in skills data,
  106.     and the department of the person in employee data is Book).
  107.     }
  108.  
  109. %%% 01.S5 %%% Q#2 %%%
  110. \query{Find the name and the budget of Ed's departments when he joined them}
  111.   {``(Toy, \$150K)'' and ``(Book, ---).''}
  112.   {(Projected, None) /
  113.    (Containment, Event, Computed) /
  114.    (=, Constant) (=, Foreign)}
  115.  
  116.   \noindent {\it Ed joined the Toy department on 2/1/82, when the budget 
  117.     was \$150K, and the Book department on 4/1/87. No information about
  118.     the Book budget is available.
  119.  
  120.     The valid-time selection is categorized as ``(Containment, Event,
  121.     Computed)'' since it checks whether the valid-times of selected budget data 
  122.     contain an event-valued argument computed from employee data 
  123.     (the date Ed joined a department).
  124.     A non-temporal selection predicate --- in the category ``(=, Constant)'' ---
  125.     is used to select the department names and 
  126.     the periods in which Ed was in a department.
  127.     A non-temporal predicate --- in the category ``(=, Foreign)'' --- 
  128.     is used to select the budget of that
  129.     department, via the join condition {\tt dept.Department=employee.Dept}.
  130.     }
  131.  
  132. %%% 01.S5 %%% Q#3 %%%
  133. \query{Find all the data and the skills of the employees
  134.   of the Toy department when it opened}
  135.   {``(Di, \$30K, Toy, F, 10/1/60, directing).''}
  136.   {(Complete, None) / 
  137.    (Containment, Event, Computed) / 
  138.    (=, Constant) (=, Foreign)}
  139.  
  140.   \noindent {\it The Toy department opened on 1/1/82. On that date,
  141.     only Di worked in it. She was qualified for directing only.
  142.  
  143.     The result is composed of all the non-temporal attributes 
  144.     retrieved from the relations employee and skills according
  145.     to the output category ``(Complete, None)''.
  146.     In both relations, data are selected if their valid-times contain
  147.     the event ``opening of the Toy department'', according to
  148.     two selection clauses in the category ``(Containment, Event, Computed)''.
  149.     Additional non-temporal conditions are imposed to the selected data in either relations:
  150.     ``(=, Constant)'' indicates the selection of the employees working in the Toy department;
  151.     ``(=, Foreign)'' indicates the selection of the skills of such employees.
  152.     Another predicate of the class ``(=, Constant)'' is used to determine the event
  153.     ``opening of the Toy department'' as the beginning of the temporal element
  154.     in which Toy data are stored in relation {\tt dept}.
  155.     }
  156.  
  157. %%% 01.S5 %%% Q#4 %%%
  158. \query{Find the names of the employees who had been working in the Toy 
  159.   department before the budget was decreased}
  160.   {``Ed.''}
  161.   {(Projected, None) /
  162.    (Ordering, Event, Computed) (Ordering, Interval, Computed) /
  163.    (=, Constant) ($<>$, Constant)}
  164.  
  165.   \noindent {\it The budget of the Toy department was decreased on 1/1/87.
  166.     Ed is the only employee who had been working in it before that date.
  167.  
  168.     The temporal selection predicate used for categorization is
  169.     ``(Ordering, Event, Computed)''. It indicates that an ordering based
  170.     predicate is used to select employee data with valid-times preceding
  171.     an event-valued argument (i.e. 1/1/87) which is derived from stored facts.
  172.     A predicate in the category ``(=, Constant)'' is used to select an employee
  173.     working in the Toy department.
  174.     The other temporal predicate --- categorized as ``(Ordering, Interval, Computed)''
  175.     --- selects two adjacent versions of department data, testing if
  176.     their valid-time intervals meet.
  177.     Furthermore, non-temporal predicates are used to determine such versions.
  178.     ``(=, Constant)'' also indicates that the two versions must have the same 
  179.     department name: ``Toy.''
  180.     ``($<>$, Constant)'' indicates that a test must be effected on the decreasing
  181.     value of the budget data between the two versions.
  182.     }
  183.  
  184. %%% 01.S5 %%% Q#5 %%%
  185. \query{Find Ed's skills when his salary increased from \$30K to \$40K}
  186.   {``typing,'' ``filing'' and ``driving.''}
  187.   {(Projected, None) /
  188.    (Containment, Event, Computed) (Ordering, Interval, Computed) / 
  189.    (=, Constant)}
  190.  
  191.   \noindent {\it Ed had typing, filing and driving skills when his salary
  192.     was increased from \$30K to \$40K on 2/1/86.
  193.  
  194.     The query is categorized as ``(Containment, Event, Computed)''
  195.     since it selects skills data having valid times containing the event 2/1/86
  196.     which is computed from other data.
  197.     Such an event is determined considering  the two consecutive versions of
  198.     data for the employee ``Ed'', 
  199.     and extracting the beginning of the second versions.
  200.     The versions can be determined as follows: a first predicate in category
  201.     ``(=, Constant)'' selects one Ed's version (with salary \$30K);
  202.     two predicates in the categories ``(=, Constant)'' and 
  203.     ``(Ordering, Interval, Computed)'' select the Ed's version 
  204.     (with salary \$40K) that follows the first one.
  205.     A third non-temporal predicate ``(=, Constant)'' selects Ed's data 
  206.     in relation {\tt skills}.
  207.     }
  208.  
  209.  
  210.  
  211. %%% Begin of Class: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  212.  
  213. \subsubsection{Class O1.S6 (Other, Event, Other)}
  214.  
  215. %%% 01.S6 %%% Q#1 %%%
  216. \query{Find the current Toy department data}
  217.   {``(Toy, Di, \$100K).''}
  218.   {(Complete, None) /
  219.    (Containment, Event, Explicit) /
  220.    (=, Constant)}
  221.  
  222.   \noindent {\it The current manager and budget of the Toy department
  223.     are Di and \$100K, respectively.
  224.  
  225.     The temporal selection predicate 
  226.     ``(Containment, Event, Explicit)'' selects the department data whose
  227.     valid-time includes the explicit event ``now.''
  228.     A non-temporal predicate in the category ``(=, Constant)'' selects Toy data.
  229.     }
  230.  
  231. %%% 01.S6 %%% Q#2 %%%
  232. \query{Find the skills for which Ed was qualified after 1/1/83}
  233.   {``filing'' and ``driving.''}
  234.   {(Projected, None) / (Ordering, Event, Explicit) / (=, Constant)}
  235.  
  236.   \noindent {\it Ed was qualified for filing on 1/1/85 and 
  237.     for driving (for the second time in his career) on 6/1/84.
  238.     The valid-time selection predicate ``(Ordering, Event, Explicit)'' 
  239.     compares the valid-time of Ed's skills with the explicitly supplied
  240.     event 1/1/83. The non temporal predicate selects Ed's data in the
  241.     skills relation.
  242.     }
  243.  
  244. %%% 01.S6 %%% Q#3 %%%
  245. \query{Find Di's salary on her 25$^{th}$ birthday}
  246.   {``\$40K.''}
  247.   {(Projected, None) /
  248.    (Containment, Event, User-defined) / 
  249.    (=, Constant)}
  250.  
  251.   \noindent {\it The date of Di's 25$^{th}$ birthday is 10/1/85.
  252.     At that time her salary was \$40K.
  253.  
  254.     The valid-time selection embedded in the query is categorized as 
  255.     ``(Containment, Event, User-defined),'' since it selects employee data
  256.     whose valid-time contains an event computed from the user-defined
  257.     time attribute {\tt D-birth}. Two non-temporal selections in the category 
  258.     ``(=, Constant)'' are used to select employees whose name is ``Di''
  259.     (once to select her {\tt D-birth} and once to select her {\tt Salary}).
  260.     }
  261.  
  262. %%% 01.S6 %%% Q#4 %%%
  263. \query{Find the departments Ed worked in before and not after 1/1/88}
  264.   {``Toy.''}
  265.   {(Projected, None) /  
  266.    (Ordering, Event, Explicit) / 
  267.    (=, Single)(=, Constant)}
  268.  
  269.   \noindent {\it
  270.     Before 1/1/88 Ed  worked only in the Toy department (from 2/1/82 to 1/31/87).
  271.  
  272.     The query can be answered in two steps.
  273.     At first, the names of all the departments Ed worked in
  274.     are selected by means of a ``(=, Const)'' non-temporal predicate.
  275.     In the second step, each name is used to find out the temporal element
  276.     in which Ed worked in such a department by means of
  277.     a ``(=, Single)'' non-temporal predicate.
  278.     Finally, the department name is retrieved only if the temporal element precedes
  279.     the event-valued constant 1/1/88
  280.     according to an ``(Ordering, Event, Explicit)'' temporal selection predicate.
  281.     }
  282.  
  283. %%% 01.S6 %%% Q#5 %%%
  284. \query{Find the name and date of birth of the women who were working
  285.   in the Toy department on 1/1/83}
  286.   {``(Di, 10/1/60).''}
  287.   {(Projected, None) /
  288.    (Containment, Event, Explicit) / 
  289.    (=, Constant)}
  290.  
  291.   \noindent {\it The only woman working in Toy department on 1/1/83 was Di. 
  292.     Di was born on 10/1/60.
  293.  
  294.     The categorization of the query as ``(Containment, Event, Explicit)''
  295.     indicates that employee data are selected if their valid-times contain
  296.     the event 1/1/83, explicitly supplied in the query.
  297.     Furthermore, the non-temporal clause selects only female employees
  298.     working in the Toy department.
  299.     }
  300.  
  301. \subsection{Valid-time Output}
  302.  
  303. This section involves queries which return only valid-time
  304. values---no explicit-attribute values are present in the result.
  305.  
  306.  
  307.  
  308. %%% Begin of Class: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  309.  
  310. \subsubsection{Class O2.S7 (Other, Interval, Computed)}
  311.  
  312. %%% 02.S7 %%% Q#1 %%%
  313. \query{Find when the Toy budget decreased}
  314.   {``1/1/87.''}
  315.   {(None, Not Empty) /
  316.    (Ordering, Interval, Computed) /
  317.    (=, Constant) ($<>$, Single)}
  318.  
  319.   \noindent {\it The budget of the Toy department decreased on 1/1/87.
  320.  
  321.     The required date is extracted when two consecutive periods are found
  322.     (i.e. selected via the predicate ``(Ordering, Interval, Computed)'')
  323.     in the first of which the budget of the Toy department was higher than in the second one
  324.     (as tested by ``($<>$, Single)''). The category ``(=, Constant)'' indicates
  325.     that Toy data are selected in relation {\tt dept} via a non-temporal
  326.     predicate testing the equality of the key with a constant.
  327.     The required date is extracted as the beginning of the valid-time of the
  328.     second period.
  329.     }
  330.  
  331. %%% 02.S7 %%% Q#2 %%%
  332. \query{Find when the name of an employee was presumably changed}
  333.   {``1/1/88.''}
  334.   {(None, Not Empty) /  
  335.    (Ordering, Interval, Computed) / 
  336.    (=, Single) ($<>$, Single)}
  337.  
  338.   \noindent {\it
  339.     Only ED's name changed from Ed to Edward on 1/1/88.
  340.  
  341.     We can guess that employees with different names but
  342.     with the same gender and date of birth are the same person
  343.     (also the salary and the department before and after the name
  344.     change can be tested for equality, but their values could
  345.     have been changed together with the name).
  346.     The retrieved event is the validity beginning of the second
  347.     of two consecutive employee versions.
  348.     Such versions are detected by means of the following conditions:
  349.     their valid-time intervals meet (cf. ``(Ordering, Interval, Computed)''),
  350.     their time-invariant attributes but the name are equal
  351.     (cf. ``(=, Single)'' used twice), their names are different
  352.     (cf. ``($<>$, Single)'').
  353.     }
  354.  
  355. %%% 02.S7 %%% Q#3 %%%
  356. \query{Find when the salary of a manager increased}
  357.   {``8/1/84'' and ``9/1/86.''}
  358.   {(None, Not Empty) /
  359.    (Ordering, Interval, Computed) 
  360.    (Containment, Element, Computed) / 
  361.    (=, Foreign) (=, Const) ($<>$, Single)}
  362.  
  363.   \noindent {\it The only manager in our data is Di.
  364.     Di's salary was increased on 8/1/84 and on 9/1/86.
  365.  
  366.     First, all the manager names (together with the valid-times 
  367.     they were manager) are retrieved from the relation {\tt dept}
  368.     by means of a simple projection.
  369.     Then, the data of each manager are selected in the relation {\tt emp} by means of
  370.     a non-temporal predicate in the class ``(=, Foreign)'' and a valid-time
  371.     predicate in the class ``(Containment, Element, Computed)''.
  372.     In order to find the desired events, two consecutive versions of the data
  373.     of a manager with increasing salary must be detected. 
  374.     The desired dates are extracted as the begin of the valid-time
  375.     interval of the second version.
  376.     A version of the manager data is selected via the ``(=, Foreign)'' predicate
  377.     as a candidate to be the first desired version.
  378.     The second version is selected in relation {\tt emp} if
  379.     its valid-time interval is met by the valid-time interval of the
  380.     first version (temporal selection in 
  381.     category ``(Ordering, Interval, Computed)''),
  382.     has the same {\tt Name} and has a greater {\tt Salary} than the first version
  383.     (non-temporal selection with categories ``(=, Constant)'' 
  384.     and ``($<>$, Single)'').
  385.     Notice that, if the name equality for the second version is tested
  386.     with the names retrieved from {\tt dept}
  387.     rather than with the name in the first selected version, two predicates
  388.     of the class ``(=, Foreign)'' are used and ``(=, Constant)''
  389.     is no longer present in the categorization.
  390.     }
  391.  
  392. %%% 02.S7 %%% Q#4 %%%
  393. \query{Find the periods in which Di earned \$40K while
  394.   she was manager of the Toy department}
  395.   {``8/1/84 -- 8/31/86.''}
  396.   {(None, Not Empty) /
  397.    (Containment, Interval, Computed) / 
  398.    (=, Constant)}
  399.  
  400.   \noindent {\it DI has been manager of the Toy department since 1982.
  401.     In this period, she earned \$40K from 8/1/84 to 8/31/86.
  402.  
  403.     The query selects the valid-time intervals --- of the employee
  404.     data with name ``Di'' and salary \$40K, according to
  405.     ``(=, Constant)'' non-temporal selection --- completely contained in another
  406.     interval computed from other data, according to
  407.     a ``(Containment, Interval, Computed)'' predicate.
  408.     Such an interval is the valid time she was manager of the Toy department
  409.     and is selected from the relation {\tt dept} via a non-temporal predicate
  410.     in the category  ``(=, Const)''
  411.     concerning the {\tt Manager} attribute value.
  412.     }
  413.  
  414. %%% 02.S7 %%% Q#5 %%%
  415. \query{Find the acquisition dates of the skills Ed had during the year
  416.   he joined the Toy department}
  417.   {``1/1/82'' and ``4/1/82.''}
  418.   {(None, Not Empty) / 
  419.    (Containment, Interval, Computed) / 
  420.    (=, Constant)}
  421.  
  422.   \noindent {\it Ed joined the Toy department on 2/1/82. During 1982,
  423.     he acquired a driving skill on the  1$^{st}$ of January,
  424.     and a typing skill on the  1$^{st}$ of April.
  425.     
  426.     The year 1982 is computed from the beginning of the temporal element
  427.     Ed worked in the Toy department, which is selected by means
  428.     of non-temporal predicates in the category ``(=, Constant).''
  429.     Hence, the Ed's skills (selected by another
  430.      ``(=, Constant)'' predicate) whose valid-times overlap the computed year
  431.     are retrieved according to a ``(Containment, Interval, Computed)''
  432.     temporal selection predicate.
  433.     }
  434.  
  435.  
  436.  
  437. %%% Begin of Class: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  438.  
  439. \subsubsection{Class O2.S8 (Other, Interval, Other)}
  440.  
  441. %%% 02.S8 %%% Q#1 %%%
  442. \query{Find the beginning of the period which includes the year 1989
  443.   and in which Edward had a constant salary.}
  444.   {``1/1/88.''}
  445.   {(None, Not Empty) / 
  446.    (Containment, Interval, Explicit) / 
  447.    (=, Constant)}
  448.  
  449.   \noindent {\it Edward has got a constant salary since 1/1/88.
  450.     As this period includes 1989, 1/1/88 is the answer.
  451.  
  452.     Assuming that valid-time intervals of employee data with a constant salary
  453.     can be extracted from the relation {\tt employee}
  454.     (it can be noticed that, if the relation is stored by means
  455.     of temporally homeogeneous tuples, the employee histories must be {\bf coalesced}
  456.     after projection on {\tt salary} in order to obtain maximal intervals
  457.     in which the salary has not been changed),
  458.     those concerning Edward can be selected via a ``(=, Constant)'' predicate.
  459.     The query retrieves the beginning of the computed period which contain
  460.     the explicit interval 1/1/89 -- 12/31/89, according to a 
  461.     ``(Containment, Interval, Explicit)'' temporal predicate.
  462.     }
  463.  
  464. %%% O2.S8 %%% Q#2 %%%
  465. \query{Find the dates Ed acquired a skill before or after years 1984--1985.}
  466.   {``1/1/82'' and ``4/1/82.''}
  467.   {(None, Not Empty) /  
  468.    (Ordering, Interval, Explicit) / 
  469.    (=, Constant) }
  470.  
  471.   \noindent {\it
  472.     Before or after years 1984--1985, Ed acquired a skill on 1/1/82 (driving)
  473.     and on 4/1/82 (typing).
  474.  
  475.     The beginning of the valid-times of Ed's skills are selected if they
  476.     precede or follow the explicit interval ``1/1/84 -- 12/31/85,''
  477.     according to the category ``(Ordering, Interval, Explicit).''
  478.     A non-temporal predicate in the category ``(=, Constant)''
  479.     is used to select Ed's data in relation {\tt skills}.
  480.     }
  481.  
  482. %%% 02.S8 %%% Q#3 %%%
  483. \query{Find ED's unemployment periods when he was not 30 years old}
  484.   {``1/31/87 -- 1/4/87.''}
  485.   {(None, Not Empty) /  
  486.    (Ordering, Interval, User-defined) (Containment, Interval, User-defined) / 
  487.    (=, Constant)}
  488.  
  489.   \noindent {\it
  490.     ED has been 30 years old from 7/1/85 to 6/30/86.
  491.     Before 7/1/85 or after 6/30/86,
  492.     he was unemployed from 1/31/87 to 1/4/87.
  493.  
  494.     The query is categorized as ``(Ordering, Interval, User-defined)''
  495.     because valid-times of data are selected if they precede or follow an
  496.     interval which is computed from user-defined times stored in other data,
  497.     that is 7/1/85 -- 6/30/86.
  498.     The other temporal predicate, in the category
  499.     ``(Containment, Interval, User-defined),'' is used because valid-times qualify
  500.     for the query also when they overlap the interval 7/1/85 -- 6/30/86 without
  501.     being completely contained in it. In this case, only the portion of the qualifying
  502.     intervals outside 7/1/85 -- 6/30/86 must be retrieved.
  503.     Non-temporal predicates in the category ``(=, Constant)'' are used
  504.     to restrict {\tt employee} to ED's data ({\tt Name="Ed"} or {\tt Name="Edward"}),
  505.     and to find out the periods in which he was unemployed
  506.     (e.g. testing for null values of his department
  507.     and salary; for the problem of coalescing intervals, see the discussion
  508.     of query {Q \theqnumber.\thernumber.1}).
  509.     The restriction to ED's data also allows the determination of
  510.     his date of birth which is used for the temporal selection.
  511.     }
  512.  
  513. %%% 02.S8 %%% Q#4 %%%
  514. \query{Find the period in which Di worked in the department
  515.   in which she has been working during the whole 1987}
  516.   {``1/1/82 -- now.''}
  517.   {(None, Not Empty) /  
  518.    (Containment, Interval, Explicit) / 
  519.    (=, Constant)}
  520.  
  521.   \noindent {\it Di worked in Toy department during 1987.
  522.     She has worked in that department from 1/1/82.
  523.  
  524.     The category ``(Containment, Interval, Explicit)'' indicates that
  525.     a containment-based predicate is used to select employee data
  526.     whose valid-times contain the user-supplied interval ``1/1/87 -- 12/31/87.''
  527.     As in Query {Q \theqnumber.\thernumber.1}, we assume that periods in which an employee worked
  528.     in the same department can be determined.
  529.     Di's data are selected via a ``(=, Constant)'' non-temporal predicate.
  530.     If the containment test succeds, the entire element-valued valid-time
  531.     argument of the predicate is retrieved.}
  532.  
  533. %%% 02.S8 %%% Q#5 %%%
  534. \query{Find all the dates from 1/1/83 to 12/31/85 at which
  535.   the Toy department budget changed}
  536.   {``8/1/84.''}
  537.   {(None, Not Empty) /  
  538.    (Containment, Interval, Explicit) (Ordering, Interval, Computed) / 
  539.    (=, Single) ($<>$, Single)}
  540.  
  541.   \noindent {\it
  542.     From 1/1/83 to 12/31/85, the Toy budget changed only on 8/1/84.
  543.  
  544.    In this query, there are two valid-time selection  predicates.
  545.    The one used for categorization is ``(Containment, Interval, Explicit)''
  546.    and selects the dates of interest by means of their containment in an interval
  547.    explicitly supplied in the query.
  548.    The other one, ``(Ordering, Interval, Computed),'' is used to determine two
  549.    consecutive versions of department data, testing if their valid-time intervals meet.
  550.    The non-temporal predicates are also used for their determination:
  551.    the two versions must have the same department name --- according to ``(=, Single)''
  552.    --- and different salary values --- according to ``($<>$, Single)''.
  553.    }
  554.  
  555. \subsection{Explicit-attribute and Valid-time Output}
  556.  
  557. The output from queries in this section contains explicit attribute
  558. values with associated valid times.
  559.  
  560.  
  561.  
  562. %%% Begin of Class: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  563.  
  564. \subsubsection{Class O3.S9 (Other, Element, Computed)}
  565.  
  566. %%% 03.S9 %%% Q#1 %%%
  567. \query{Find Ed's salary history when he had a driving skill}
  568.   {``(\$20K, 2/1/82 -- 5/1/82),''
  569.    ``(\$30K, 6/1/84 -- 1/31/85)'' and
  570.    ``(\$40K, 2/1/85 -- 1/31/87 $\cup$ 4/1/87 -- 12/31/87)''}
  571.   {(Projected, Not Empty) / 
  572.    (Containment, Element, Computed) / 
  573.    (=, Constant)}
  574.  
  575.   \noindent {\it Ed has been qualified for driving from 2/1/82 to 5/1/82
  576.     and from 6/1/84 to 12/31/87 (after that, Edward nor Ed had).
  577.     In those periods, he earned \$20K from 2/1/82 to 5/1/82,
  578.     \$30K from 6/1/84 to 1/31/85 and \$40K from 2/1/85 to 1/31/87
  579.     and from 4/1/87 to 12/31/87.
  580.     
  581.     A non-temporal ``(=, Constant)'' is used to select Ed's data in
  582.     relation {\tt emp}.
  583.     Ed's salary data are retrieved if their valid-times are contained
  584.     in an element-valued period computed from stored facts, according
  585.     to ``(Containment, Element, Computed)''.
  586.     Such period is computed by means of other ``(=, Constant)'' predicates
  587.     which select data with {\tt Name="Ed"} and {\tt Skill="driving"}
  588.     in relation {\tt skills}. 
  589.     }
  590.  
  591. %%% 03.S9 %%% Q#2 %%%
  592. \query{Find the salary history, during the periods in which ED
  593.   had a driving skill, of the employees who earned less than \$50K in 1989}
  594.   {``(---, 1/1/82 -- 1/31/82),''
  595.    ``(\$20K, 2/1/82 -- 5/1/82),''
  596.    ``(\$30K, 6/1/84 -- 1/31/85),''
  597.    ``(\$40K, 2/1/85 -- 1/31/87),''
  598.    ``(---, 1/31/87 -- 3/30/87)'' and
  599.    ``(\$40K, 4/1/87 -- 5/31/88).''}
  600.   {(Projected, Not Empty) / 
  601.    (Containment, Element, Computed) 
  602.    (Containment, Interval, Explicit) / 
  603.    (=, Constant) ($<>$, Constant)}
  604.  
  605.   \noindent {\it ED was qualified for driving from 1/1/82 to 5/1/82 and
  606.     from 6/1/84 to 5/31/88. 
  607.     The only employee who earned less than \$50K in 1989 is ED again.
  608.     While he had the driving skill, his salary was 
  609.     \$20K from 2/1/82 to 5/1/82,
  610.     \$30K from 6/1/84 to 1/31/85,
  611.     \$40K from 2/1/85 to 1/31/87 and from 4/1/87 to 5/31/88
  612.     (unknown from 1/1/82 to 1/31/82 and from 1/31/87 to 3/30/87).
  613.  
  614.     Two valid-time selection predicates are present in the query.
  615.     One --- ``(Containment, Interval, Explicit)'' --- is used
  616.     to select the objects of interest, whereas the other
  617.     --- ``(Containment, Element, Computed)'' --- is used
  618.     to select a portion of their data history.
  619.     Objects qualify if the salary is less that \$50K (cf. ``($<>$, Constant)'')
  620.     in their employee data selected by the temporal predicate 
  621.     ``(Containment, Element, Computed),'' extracting
  622.     the versions with valid-times overlapped by the user-supplied interval
  623.     ``1/1/89 -- 12/31/89''.
  624.     The other non-temporal predicate is used to evaluate
  625.     the element-valued period in which ED had the driving skill
  626.     (cf. ``(=, Constant)'' testing for {\tt skills.Name} equal to ``Ed'' or ``Edward'').
  627.     Such period is used as argument by the temporal predicate used for categorization.
  628.     }
  629.  
  630. %%% 03.S9 %%% Q#3 %%%
  631. \query{Find the name and salary history of the male employees
  632.   in the periods they were directed by a woman}
  633.   {``(\$20K, 2/1/82 -- 5/31/82),'' and
  634.    ``(\$30K, 6/1/82 -- 1/31/85).''
  635.   }
  636.   {(Projected, Not Empty) / 
  637.    (Containment, Element, Computed) 
  638. %   (Containment, Interval, Computed) 
  639. %   (Containment, Interval, Computed) 
  640. %   (Containment, Interval, Computed) / 
  641.    (=, Constant) (=, Foreign)}
  642.  
  643.   \noindent {\it The only employee qualifying for the query is Ed,
  644.     since he had been directed by Di when he worked in the Toy department
  645.     from 2/1/82 to 1/31/87.
  646.     His salary history in that period is:
  647.     \$20K from 2/1/82 to 5/31/82, \$30K from 6/1/82 to 1/31/85
  648.     and \$40K from 2/1/85 to 1/31/87.
  649.  
  650.     The objects of interest for this query are the male employee which can
  651.     be identified by a ``(=, Constant)'' predicate in the relation {\tt emp}.
  652.     The query is categorized as ``(Containment, Element, Computed),''
  653.     since it selects the data of the selectd objects having their valid-times
  654.     contained in an element-valued argument computed from other stored facts.
  655.     In order to find out such an element, two temporal joins must be effected:
  656.     one between the relations {\tt emp} and {\tt dept}, to find out the department data
  657.     of the selected employee, and the other between the relations {\tt dept} and {\tt emp}
  658.     again, to find out the department manager data.
  659.     The two joins can be categorized as ``(=, Foreign)'' and
  660.     ``(Containment, Element, Computed)'', because the join attribute equality and
  661.     the overlap of the valid-times must be ensured.
  662.     The intersection of the valid-times of the histories joined, with the final
  663.     local restriction {\tt emp.Gender=F} on the manager data, gives the
  664.     desired temporal element.
  665.     }
  666.  
  667. %%% 03.S9 %%% Q#4 %%%
  668. \query{Find the department name, the manager name and the periods, for which
  669.   a department manager earned more than one third of the department budget}
  670.   {``(Toy, Di, 1/1/87 -- now).''}
  671.   {(Projected, Not Empty) / 
  672.    (Containment, Element, Computed) / 
  673.    ($<>$, Arbitrary)}
  674.  
  675.   \noindent {\it The only stored information about department managers is that
  676.     Di has directed the Toy department from 1/1/82.
  677.     She earned more than one third of the department budget from 1/1/87 to the present
  678.     (cf. \$50K $>$ \$100K/3).
  679.  
  680.     For each department, the requested data are retrieved by means
  681.     of a temporal join between relations {\tt dept} and {\tt emp}.
  682.     The categorizations of the temporal join conditions are the following:
  683.     ``(=, Foreign)'' for the equality {\tt emp.Name=dept.Manager},
  684.     ``(Containment, Element, Computed)'' for the overlap of the salary valid-times with
  685.     the valid-times he/she was manager, ``($<>$, Arbitrary)'' for the further comparison
  686.     between department budget and manager salary.
  687.     }
  688.  
  689. %%% 03.S9 %%% Q#5 %%%
  690. \query{Find the name and the salary history of the employees
  691.   in the periods they earned as much as their managers}
  692.   {``(Ed, \$30K, 6/1/83 -- 7/31/84)'' and ``(Ed, \$40K, 2/1/86 -- 8/31/86).''}
  693.   {(Projected, Not Empty) / 
  694. %   (Containment, Element, Computed) 
  695. %   (Containment, Element, Computed) 
  696.    (Containment, Element, Computed)
  697.    (Containment, Interval, Computed) / 
  698.    (=, Foreign) (=, Single) ($<>$, Single)}
  699.  
  700.   \noindent {\it The only relationship directed-director between employees
  701.     which can be retrieved from the data is Ed-Di, which held
  702.     from 2/1/82 to 1/31/87 at the Toy department.
  703.     Ed earned as much as Di from 6/1/83 to 7/31/84 (\$30K) and
  704.     from 2/1/86 to 8/31/86 (\$40K).
  705.  
  706.     The query retrieves salary histories of the employees who earned
  707.     as much as the employee who was the manager of the department they worked in.
  708.     Such employees, and the periods of interest, can be selected via a {\bf cyclic} 
  709.     temporal join between {\tt emp} and {\tt dept}.
  710.     As a matter of fact, ``(=, Foreign)'' non-temporal predicates allow us
  711.     to express the join conditions {\tt dept.Department=emp.Dept}
  712.     and {\tt emp.Name=dept.Manager} as in Query {Q \theqnumber.\thernumber.3},
  713.     a ``(=, Single)'' non-temporal predicate allows us to express the furter 
  714.     join condition on salary equality between employee and manager,
  715.     whereas ``(Containment, Element, Computed)''
  716.     temporal selection predicates allow us to join data versions
  717.     synchronized along valid-time.
  718.     An additional ``($<>$, Single)'' condition is assumed in the last join 
  719.     to ensure selected employees do not have the same name as their managers.
  720.     }
  721.  
  722.  
  723.  
  724. %%% Begin of Class: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  725.  
  726. \subsubsection{Class O3.S10 (Other, Element, Other)}
  727.  
  728. %%% 03.S10 %%% Q#1 %%%
  729. \query{Find the budget history in the period 
  730.   from 1/1/82 to 12/31/84 and from 1/1/87 till now
  731.   of the department Ed ever worked in}
  732.   {``(Toy, \$150K, 2/1/82 -- 7/31/84),''
  733.    ``(Toy, \$200K, 8/1/84 -- 12/31/84),''
  734.    ``(Toy, \$100K, 1/1/87 -- now),''
  735.    ``(Book, --- , 1/1/82 -- 12/31/84)'' and
  736.    ``(Book, ---, 1/1/87 -- now).''}
  737.   {(Projected, Not Empty) / 
  738.    (Containment, Element, Explicit) /
  739.    (=, Foreign) (=, Constant) 
  740.    }
  741.  
  742.   \noindent {\it Ed worked in the Toy and in the Book department.
  743.     The budget history of the Toy department in the required period is:
  744.     \$150K from 2/1/82 to 7/31/84, \$200K from 8/1/84 to 12/31/84
  745.     and \$100K from 1/1/87 till now.
  746.     The budget history of the Book department in the same period is
  747.     not available from the stored data (we assume ``nulls'' to be retrieved).
  748.  
  749.     The departments in which Ed ever worked can be found by means of a
  750.     ``(=, Constant)'' predicate on the employee data.
  751.     The collected values are then used to select budget histories in the
  752.     relation {\tt dept} via a ``(=, Foreign)'' predicate.
  753.     Eventually, portions of such histories are selected by means of a
  754.     valid-time predicate categorized as ``(Containment, Element, Explicit)''
  755.     since it exctracts data with valid-times contained in the user-supplied
  756.     temporal element ``1/1/82 -- 12/31/84 $\cup$ 1/1/87 --- now.''
  757.     }
  758.  
  759. %%% 03.S10 %%% Q#2 %%%
  760. \query{Find the name and the budget history in 1984 and 1987
  761.   of the department being directed by Di}
  762.   {``(Toy, \$150K, 1/1/84 -- 7/31/84),''
  763.    ``(Toy, \$200K, 8/1/84 -- 12/31/84)'' and
  764.    ``(Toy, \$100K, 1/1/87 -- 12/31/87).''}
  765.   {(Projected, Not Empty) / 
  766.    (Containment, Element, Explicit) / 
  767.    (=, Constant)}
  768.  
  769.   \noindent {\it
  770.     In the periods from 1/1/84 to 12/31/84 and from 1/1/87 to 12/31/87,
  771.     Di always directed the Toy department.
  772.     The Toy budget was \$150K from 1/1/84 to 7/31/84,
  773.     \$200K from 8/1/84 to 12/31/84
  774.     and \$100K from 1/1/87 to 12/31/87.
  775.  
  776.     The query is categorized as ``(Containment, Element, Explicit)'' since
  777.     it selects data contained in an element-valued time constant supplied by the user
  778.     (1/1/84 -- 12/31/84 $\cup$ 1/1/87 -- 12/31/87).
  779.     ``(=, Constant)'' indicates the non-temporal selection of the department data
  780.     where the manager is Di.
  781.     }
  782.  
  783. %%% 03.S10 %%% Q#3 %%%
  784. \query{Find the names of the department where Ed was working 
  785.   at the beginning of the years 1986 and 1987, 
  786.   and the periods Ed worked there.}
  787.   {``(Toy, 2/1/82 -- 1/31/87).''}
  788.   {(Projected, Not Empty) /  
  789.    (Containment, Element, Explicit) / 
  790.    (=, Constant)}
  791.  
  792.   \noindent {\it
  793.     On 1/1/86 and 1/1/87 Ed was working at the Toy department.
  794.     He has been working in that department from 2/1/82 to 1/31/87.
  795.     
  796.     The query can be answered in two steps.
  797.     First, department names are selected if stored as data concerning Ed
  798.     by means of a ``(=, Constant)'' predicate testing for the employee name.
  799.     Second, the department names are retrieved together with their valid times
  800.     if these contain the explicit element ``1/1/86 $\cup$ 1/1/87'', by using
  801.     a ``(Containment, Element, Explicit)'' valid-time selection predicate.
  802.     }
  803.  
  804. %%% 03.S10 %%% Q#4 %%%
  805. \query{Find the name of the manager Ed had on 1984's Christmas 
  806.   and on his 27$^{th}$ birthday, and the dates he/she began 
  807.   to be manager of their department,}
  808.   {``(Di, 1/1/82).''}
  809.   {(Projected, Not Empty) /  
  810.    (Containment, Element, User-defined) / 
  811.    (=, Constant) (=, Single) (=, Foreign)}
  812.  
  813.   \noindent {\it
  814.     Ed's 27$^{th}$ birthday was 7/1/82. On 7/1/82 and on 12/25/1984,
  815.     he worked in the Toy department, directed by Di.
  816.     Di started to direct this department on 1/1/82.
  817.  
  818.     The query contains a ``(Containment, Element, User-defined)'' valid-time
  819.     predicate selecting data whose valid-times contain an element-value argument
  820.     computed from a user-defined time attribute. As a matter of fact, the element
  821.     ``7/1/82 $\cup$ 12/25/1984'' is computed by means of a date explicitly supplied
  822.     in the query and from the Ed's date of birth, selected via a ``(=, Constant)''
  823.     predicate in relation {\tt employee}.
  824.     The first argument used by the valid-time selection predicate is the element-valued
  825.     period in which Ed worked in a department. This period can be evaluated from Ed's data
  826.     by means of a non-temporal selection predicate ``(=, Single)'', which tests
  827.     employee data for a department name, once the department names have been selected.
  828.     Finally, if a department name qualifies, it is used --- via a ``(=, Foreign)''
  829.     predicate and together with the valid-time selection predicate --- to select
  830.     the manager data (name and valid-time) in relation {\tt dept}.
  831.     }
  832.  
  833. %%% 03.S10 %%% Q#5 %%%
  834. \query{Find the department name, the then manager,
  835.    the modification dates and the new values of the budget
  836.    for every budget change occurred in 1984, 1986 and 1988.}
  837.   {``(Toy, Di, \$200K, 8/1/84).''}
  838.   {(Complete, Not Empty) /
  839.    (Containment, Element, Explicit)
  840.    (Ordering, Interval, Computed) / 
  841.    (=, Single) ($<>$, Single)}
  842.  
  843.   \noindent {\it No data are available about the Book department budget.
  844.     The Toy department budget changed on 8/1/84 and 1/1/87.
  845.     Only the first date qualifies for the query. The manager at this time 
  846.     was Di and the new budget value was \$200K.
  847.  
  848.     The query is classified as ``(Containment, Element, Explicit)''
  849.     because it uses a valid-time predicate to select data whose valid-times
  850.     are contained in an element-valued argument supplied in the query
  851.     (i.e. ``1/1/84 -- 12/31/84 $\cup$ 1/1/86 -- 12/31/86 $\cup$ 1/1/88 -- 12/31/88'').
  852.     Candidate data are snaphots of the department data taken on budget changes.
  853.     Budget changes are detected by means of the comparison of two consecutive
  854.     department data versions.
  855.     The first one can be freely selected, whereas the second one is
  856.     the version of the same department (equality of the key ensured by means
  857.     of a ``(=, Single)'' predicate) that follows the first one (as ensured
  858.     by a temporal ``(Ordering, Interval, Computed)'' predicate).
  859.     The two versions qualify --- and the validity beginning of the second one is
  860.     selected as a candidate date --- if their budget values differ,
  861.     according to a ``($<>$, Single)'' predicate.
  862.     }
  863.  
  864. \end{document}
  865.  
  866.  
  867. %%%%%%%%%%%%%%%%%%%%%
  868. %%% Query template: 
  869. %%%%%%%%%%%%%%%%%%%%%
  870.  
  871. %%% O.S %%% Q# %%%
  872. \query{}
  873.   {``.''}
  874.   {() /  
  875.    () / 
  876.    ()}
  877.  
  878.   \noindent {\it
  879.     }